package L1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class _054 {
    /**
     * 福到了
     */
    public static void main(String[] args) throws IOException {
        BufferedReader reader =new BufferedReader(new InputStreamReader(System.in));
        String[] s = reader.readLine().split(" ");
        Integer N = Integer.valueOf(s[1]);
        int[][] arr = new int[N][N];
        for (int i=0;i<N;i++){
            String line = reader.readLine();
            for (int j=0;j<N;j++){
                if (line.charAt(j)!=' '){
                    arr[i][j]=1;
                }
            }
        }
        int[][] result = new int[N][N];
        boolean flag = true;
        for (int i=0;i<N;i++){
            for (int j=0;j<N;j++){
                result[i][j] = arr[N-i-1][N-j-1];
                if (result[i][j]!=arr[i][j]){
                    flag = false;
                }
            }
        }
        if (flag){
            System.out.println("bu yong dao le");
        }
        for (int i=0;i<N;i++){
            for (int j=0;j<N;j++){
                if (result[i][j]==0){
                    System.out.print(" ");
                }else {
                    System.out.print(s[0]);
                }
            }
            System.out.println();
        }
    }
}
